
import com.fz.entity.Book;
import com.fz.mapper.BookMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by webrx on 2017/7/6.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:beans.xml")
public class Dom01 {

  // @Autowired
   /* @Resource(name = "")
    protected BookMapper books;

    @Autowired
    protected DriverManagerDataSource

    @Test
    public void show(){

        List<Book> list = books.queryAll();
        *//*for(Book book: list){
            System.out.println(book.getName());
        }*//*
        int nn =books.deleteById(37);
        System.out.println(nn);
    }*/
    @Test
    public void jdbc() throws SQLException {

       // Connection conn = ds.getConnection();
        String sql =" select name_n nn ,price_p from book where 1=1 ";
       // PreparedStatement pre = conn.prepareStatement(sql);
       // ResultSet rest = pre.executeQuery();
      /*  while(rest.next()){

            System.out.println(rest.getString(""));
        }
        //pre.executeQuery();
        System.out.println(conn);*/
    }
    @Test
    public void aa(){

    }

}
